//
//  RCDAvatarWithMaskControl.m
//  students
//
//  Created by 任辰东 on 2024/2/23.
//

#import "RCDAvatarWithMaskControl.h"

@interface RCDAvatarWithMaskControl ()

@property (nonatomic, strong) UIImageView *avatarImgView;

@end

@implementation RCDAvatarWithMaskControl

- (instancetype)init
{
    if (self = [super init]) {
        
        _avatarImgView = [UIImageView new];
        _avatarImgView.backgroundColor = UIColor.lightGrayColor;
        [self addSubview:_avatarImgView];
        
        UIImageView *maskImgView = [UIImageView new];
        maskImgView.image = UIImageWithName(@"avatar_shade");
        [self addSubview:maskImgView];
        
        [maskImgView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(self);
        }];
        
        [_avatarImgView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(self);
        }];
    }
    return self;
}

- (void)setAvatarUrl:(NSString *)avatarUrl
{
    _avatarUrl = avatarUrl;
    [self.avatarImgView sd_setImageWithURL:[NSURL URLWithString:avatarUrl]];
}

@end
